#include "timeOperater.h"

TimeOperater::TimeOperater()
{
    //ctor
}

string TimeOperater::getTime(int type)
{
    time_t nowTime = time(NULL);
    //cout<<nowTime<<endl;
    tm *sTime = gmtime(&nowTime);
    string timeTerm = "";
    stringstream time;
    switch(type)
    {
        case 0:
            time << (sTime->tm_year + 1900);
            break;
        case 1:
            time << (sTime->tm_year + 1901);
            break;
        case 2:
            time << (sTime->tm_year + 1903);
            break;
        default:
            return NULL;

    }
    time >> timeTerm;
    string theTime = "";

    theTime += timeTerm + "/";


    time.clear();
    time << sTime->tm_mon;
    time >> timeTerm;
    theTime += timeTerm + "/";

    time.clear();
    time << sTime->tm_mday;
    time >> timeTerm;
    theTime += timeTerm + "/";

    return theTime;
}

TimeOperater::~TimeOperater()
{
    //dtor
}
